<%@ page language="java" contentType="text/html; charset=UTF-8"
import="it.polimi.swim.entity.SystemUser, it.polimi.swim.entity.HelpRequest,java.util.ArrayList,java.util.Set"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Help Requests</title>
<link rel="stylesheet" type="text/css" href="myStyle.css">
</head>
<body>
<div id='header' >
	<div style="float:left"><a href="homeUser.jsp">SWIMv2</a></div>
	<div style="float:right;"><a href="SignoutServlet">Sign out</a></div>
</div>
<div id="content">
<h3>Help Requests sent from me:</h3>
<%
Set<HelpRequest> helps = (Set<HelpRequest>) request.getAttribute("otherHelpRequest");
Set<HelpRequest> myHelpRequest = (Set<HelpRequest>) request.getAttribute("myHelpRequest");
for(HelpRequest h:helps){
	%>
	<form action="HelpRequestAnswerServlet" method="post">
	<%
	out.print("Title: "+h.getTitle()+"<br>");
	out.print("Description: "+h.getDescription()+"<br>");
	out.print("Sender: "+h.getIdCreator().getName()+" "+h.getIdCreator().getSurname()+"<br>");
	out.print("Skill: "+h.getNecessarySkill().getName()+"<br><br>");
	out.print("<input type='hidden' value='"+h.getId()+"' name='idHelp'>");
	Boolean b = h.isStatus();
	if(!b){
	%>
	<input type="submit" value="Accept" name="ans">
	<input type="submit" value="Deny" name="ans"><%}
	else out.print("Accepted<Br>");
	%>
	<hr>
	</form>
<%}%>
<h3>Help Requests sent from other Users to me:</h3>
<%
for(HelpRequest h:myHelpRequest){
	out.print("Title: "+h.getTitle()+"<br>");
	out.print("Description: "+h.getDescription()+"<br>");
	out.print("Skill: "+h.getNecessarySkill().getName()+"<br><br>");
	out.print("<input type='hidden' value='"+h.getId()+"' name='idHelp'>");
	%>
	<hr>
	<%}%>
</div>
</body>
</html>